REM //******************************************************************************
REM // Call of Duty 7: Black Ops
REM //******************************************************************************
REM // Mod      : The OpenWarfare Project... An Open Source Mod for COD7:BO!
REM // Website  : http://openwarfaremod.com/
REM //******************************************************************************

@echo off
set COMPILEDIR=%CD%
set color=1e
color %color%

:START
cls
echo.
echo.  _____                  _    _             __
echo. ^|  _  ^|                ^| ^|  ^| ^|           / _^|
echo. ^| ^| ^| ^|_ __   ___ _ __ ^| ^|  ^| ^| __ _ _ __^| ^|_ __ _ _ __ ___
echo. ^| ^| ^| ^| '_ \ / _ \ '_ \^| ^|/\^| ^|/ _` ^| '__^|  _/ _` ^| '__/ _ \
echo. \ \_/ / ^|_) ^|  __/ ^| ^| \  /\  / (_^| ^| ^|  ^| ^|^| (_^| ^| ^| ^|  __/
echo.  \___/^| .__/ \___^|_^| ^|_^|\/  \/ \__,_^|_^|  ^|_^| \__,_^|_^|  \___^|
echo.       ^| ^|               We don't make the game you play.
echo.       ^|_^|                 We make the game you play BETTER.
echo.
echo.            Website: http://openwarfaremod.com/

:MAKEOPTIONS
echo _________________________________________________________________
echo.



:CHOOSE_LANG
echo _________________________________________________________________
echo.


:LANGEN
set CLANGUAGE=English
set LANG=english
set LTARGET=english
goto COMPILE

:LANGFR
set CLANGUAGE=French
set LANG=french
set LTARGET=french
goto COMPILE

:LANGDE
set CLANGUAGE=German
set LANG=german
set LTARGET=german
goto COMPILE

:LANGIT
set CLANGUAGE=Italian
set LANG=italian
set LTARGET=italian
goto COMPILE

:LANGPT
set CLANGUAGE=Portuguese
set LANG=portuguese
set LTARGET=leet
goto COMPILE

:LANGRU
set CLANGUAGE=Russian
set LANG=russian
set LTARGET=russian
goto COMPILE

:LANGES
set CLANGUAGE=Spanish
set LANG=spanish
set LTARGET=spanish
goto COMPILE


:COMPILE
echo.

echo  Checking language directories...
if not exist ..\..\zone\%LTARGET% mkdir ..\..\zone\%LTARGET%
if not exist ..\..\zone_source\%LTARGET% xcopy ..\..\zone_source\english ..\..\zone_source\%LTARGET% /SYI > NUL

echo  [SHIFT] will be created in %CLANGUAGE%!



:MAKE_OPENWARFARE_IWD
echo _________________________________________________________________
echo.


:BUILD_OPENWARFARE_IWD
echo _________________________________________________________________
echo.
echo  Building mp_shift.iwd:
echo    Deleting old mp_shift.iwd file...
del mp_shift.iwd
del mp_shift_configs.iwd
echo    Adding images...
7za a -r -tzip mp_shift.iwd images\*.iwi > NUL
echo    Adding configuration files...
7za a -r -tzip mp_shift_configs.iwd configs\*.gsc > NUL
7za a -r -tzip mp_shift_configs.iwd credits.txt > NUL
REM echo    Adding weapons...
REM 7za a -r -tzip z_openwarfare.iwd weapons\mp\*_mp > NUL
REM echo    Adding OpenWarfare standard rulesets...
REM 7za a -r -tzip z_openwarfare.iwd rulesets\leagues.gsc > NUL
REM 7za a -r -tzip z_openwarfare.iwd rulesets\openwarfare\*.gsc > NUL
REM echo    Adding empty mod.arena file...
REM 7za a -r -tzip z_openwarfare.iwd mod.arena > NUL
echo  New mp_shift.iwd.iwd file successfully built!
del /f /q weapons\mp\* >NUL
rmdir weapons\mp >NUL
REM if "%make_option%"=="1" goto MAKE_MOD_FF
REM goto END


:WEAPONS_FIXES
REM xcopy weapons\fixes weapons\mp /SYI > NUL
REM goto BUILD_OPENWARFARE_IWD


:WEAPONS_FIXES_NOGUNSWAY
REM xcopy weapons\fixes+nogunsway weapons\mp /SYI > NUL
REM goto BUILD_OPENWARFARE_IWD

:WEAPONS_FIXES_NOGUNSWAY_SNIPER
REM xcopy weapons\fixes+nogunsway+sniper weapons\mp /SYI > NUL
REM goto BUILD_OPENWARFARE_IWD

:WEAPONS_THECOMPANY
REM xcopy weapons\thecompany weapons\mp /SYI > NUL
REM goto BUILD_OPENWARFARE_IWD


:MAKE_RULES_IWD
echo _________________________________________________________________
echo.
REM echo  Please type the name of the ruleset to build:
REM echo.
REM echo    0. Back
REM echo.
REM set /p zow_ruleset=:
REM if "%zow_ruleset%"=="0" goto START
REM if not exist rulesets\%zow_ruleset% goto INVALID_RULESET
REM echo  Building ruleset %zow_ruleset% .IWD file:
REM echo    Deleting old .IWD ruleset file...
REM del z_svr_rs_%zow_ruleset%.iwd > NUL
REM echo    Creating new .IWD ruleset file...
REM 7za a -r -tzip z_svr_rs_%zow_ruleset%.iwd rulesets\%zow_ruleset%\*.gsc > NUL
REM echo  New ruleset .IWD file successfully built!

REM if "%make_option%"=="1" goto MAKE_MOD_FF
REM goto END

:INVALID_RULESET
REM echo  Invalid ruleset name specified!
REM goto MAKE_RULES_IWD

:MAKE_MOD_FF
echo _________________________________________________________________
echo.
echo  Building mod.ff:
echo    Deleting old mod.ff file...
del mod.ff

echo    Copying localized strings...
xcopy %LANG% ..\..\raw\%LTARGET% /SYI > NUL

echo    Copying game resources...
xcopy configs ..\..\raw\configs /SYI > NUL
xcopy images ..\..\raw\images /SYI > NUL
REM xcopy fx ..\..\raw\fx /SYI > NUL
xcopy maps ..\..\raw\maps /SYI > NUL
xcopy materials ..\..\raw\materials /SYI > NUL
xcopy mp ..\..\raw\mp /SYI > NUL
REM xcopy rulesets ..\..\raw\rulesets /SYI > NUL
REM xcopy sound ..\..\raw\sound /SYI > NUL
REM xcopy soundaliases ..\..\raw\soundaliases /SYI > NUL
xcopy ui_mp ..\..\raw\ui_mp /SYI > NUL
REM xcopy vision ..\..\raw\vision /SYI > NUL
REM xcopy weapons\fixes ..\..\raw\weapons\mp /SYI > NUL

echo    Copying shift custom items...
xcopy shift ..\..\raw\shift /SYI > NUL
xcopy myWhitelist.cfg ..\..\raw /SYI > NUL

echo    Copying xmodel resources...
xcopy physic ..\..\raw\physic /SYI > NUL
REM xcopy xanim ..\..\raw\xanim /SYI > NUL
xcopy xmodel ..\..\raw\xmodel /SYI > NUL
xcopy xmodelparts ..\..\raw\xmodelparts /SYI > NUL
xcopy xmodelsurfs ..\..\raw\xmodelsurfs /SYI > NUL

echo    Copying OpenWarfare source code...
xcopy openwarfare ..\..\raw\openwarfare /SYI > NUL
copy /Y mod.csv ..\..\zone_source > NUL
REM copy /Y mod_ignore.csv ..\..\zone_source\%LTARGET%\assetlist > NUL
cd ..\..\bin > NUL


echo    Compiling mod...
linker_pc.exe -baselang %LTARGET% -language %LTARGET% -compress -cleanup mod
cd %COMPILEDIR% > NUL
copy ..\..\zone\%LTARGET%\mod.ff > NUL
echo  New shift custom mod.ff file successfully built!
goto END


:END
echo.
RD /S /Q ..\mp_shift
md ..\mp_shift
xcopy mod.ff ..\mp_shift /SYI > NUL
xcopy mp_shift.iwd ..\mp_shift /SYI > NUL
xcopy mp_shift_configs.iwd ..\mp_shift /SYI > NUL

:RUN_GAME
echo _________________________________________________________________
echo.
echo  Please choose option:
echo    1. Start COD BO multiplayer
echo    2. Exit
echo.

choice /C:12 /T 10 /D 2
if errorlevel 2 goto FINAL
if errorlevel 1 goto ONE
goto END

:ONE
start steam://rungameid/42710

:FINAL
